
// 拒绝入队申请


// @ts-ignore
export async function execute(client_id,message_json) {
    let index = message_json["序列"];
    if (index === undefined || index <= 0) {
        ClientUtils.send_basic_prompt(client_id, "你还没有选择玩家");
        return;
    }
    
    let login_characters = G.Characters.get_current_login_characters(client_id);
    
    let team_data = G.TeamUtils.get_team_data(login_characters["队伍"]);
    if (team_data === undefined) {
        ClientUtils.send_basic_prompt(client_id, "队伍已不存在");
        return;
    }
    let apply_characters = team_data["申请"][index - 1];
    if (apply_characters === undefined) {
        ClientUtils.send_basic_prompt(client_id, "申请信息不存在");
        return;
    }
    let characters = _CharactersData.get(apply_characters["id"]);
    if(characters !== undefined){
        team_data["申请"].splice(index - 1, 1);
        let character_client_id = G.Characters.get_characters_client_id(apply_characters["id"]);
        if (character_client_id !== undefined) {
           ClientUtils.send_basic_prompt(character_client_id, "#Y队长拒绝了你的入队申请");
        }
    }else{
        //目标不在线
        team_data["申请"].splice(index - 1, 1);
        ClientUtils.send_basic_prompt(client_id, "用户不在线");
    }
    //通知客户端刷新申请列表
    ClientUtils.send_client_message(client_id, 4011, team_data["申请"]);
}
